<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        const str = "They are students", sub = "aeiou"
        function characterDeletion(str, sub) {
            const strArr = str.split('')
            const subArr = sub.split('')
            console.log(strArr);
            console.log(subArr);
            const newArr = []
            strArr.forEach(i => {
                let flag = false
                subArr.forEach((j)=>{
                    if(j==i){flag=true}
                })
                if(!flag){ newArr.push(i)}
            });

            console.log(newArr.join(''));
            return newArr.join('')
        }
        characterDeletion(str, sub)
    </script>
</body>

</html>